package com.qlm.service;

import com.jfinal.weixin.sdk.api.ApiResult;
import com.jfinal.weixin.sdk.api.SnsAccessToken;
import com.qlm.entity.User;

public interface UserService {

	static final String OPENID = "openid";// 用户openId

	static final String NICK_NAME = "nick_name";// 用户昵称

	static final String SEX = "sex";// 用户性别

	static final String COUNTRY = "country";// 国家

	static final String PROVINCE = "province";// 省份

	static final String CITY = "city";// 城市

	static final String CREATE_TIME = "create_time";// 创建时间

	static final String HEAD_PIC = "head_pic";// 头像

	User getUserInfoFromWXAndSave(String openid ,ApiResult result);
	
	/**
	 * 根据OPENid 从数据库取
	 * 
	 * @param openId
	 * @return
	 */
	User getUserById(String openId);

	/**
	 * 向微信获取用户信息，并且保存到数据库
	 * 
	 * @param code
	 * @param token
	 * @return
	 */
	User getUserInfoFromWXAndSave(String code, SnsAccessToken token);
}
